# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Michael P <ptchinster@archlinux.us>
# Contributor: Aaron Griffin <aaron@archlinux.org>
# Contributor: Elmo Todurov <todurov@gmail.com>
# Contributor: Alexander De Sousa <archaur.xandy21@spamgourmet.com>

pkgbase=scanmem
pkgname=('scanmem' 'libscanmem' 'gameconqueror')
pkgver=0.17
pkgrel=7
pkgdesc='Memory scanner designed to isolate the address of an arbitrary variable in an executing process'
url='https://github.com/scanmem/scanmem'
arch=('loong64' 'x86_64')
license=('GPL3')
makedepends=('intltool' 'gtk3' 'python-gobject' 'polkit' 'glibc' 'readline')
options=('!emptydirs')
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/${pkgname}/${pkgname}/archive/v${pkgver}.tar.gz)
sha256sums=('f02054b91322cf41517506158fcb74554e9fc6644e696f8aa25e5acf162d374b')
sha512sums=('6d74f3d1d3492d41cabc342cfd1189815536dcbd57857d8a92e05c5dcaebcb9b1df886aee706c56eaf3344737070ea0fe852eef164ef3fe7907f66c626d8523e')

prepare() {
  cd ${pkgbase}-${pkgver}
  ./autogen.sh
}

build() {
  cd ${pkgbase}-${pkgver}
  ./configure --enable-gui --prefix=/usr
  make
}

check() {
  cd ${pkgbase}-${pkgver}
  make check
}

package_scanmem() {
  depends=('libscanmem' 'glibc' 'readline')

  cd ${pkgbase}-${pkgver}
  make DESTDIR="${pkgdir}" install
  rm -r "${pkgdir}/usr/"{include,lib}
  rm -rf "${pkgdir}/usr/share/"{gameconqueror,appdata,applications,icons,locale,polkit-1}
  rm "${pkgdir}"{/usr/bin/gameconqueror,/usr/share/man/man1/gameconqueror.1}
}

package_libscanmem() {
  depends=('readline')
  pkgdesc+=" (library)"

  cd ${pkgbase}-${pkgver}
  make DESTDIR="${pkgdir}" install
  rm -r "${pkgdir}/usr/bin"
  rm -r "${pkgdir}/usr/share"
}

package_gameconqueror() {
  depends=('libscanmem' 'gtk3' 'python' 'python-gobject' 'polkit')
  pkgdesc+=" (gtk GUI)"

  cd ${pkgbase}-${pkgver}
  make DESTDIR="${pkgdir}" install
  rm -r "${pkgdir}/usr/"{include,lib,share/doc}
  rm "${pkgdir}"{/usr/bin/scanmem,/usr/share/man/man1/scanmem.1}
}

# vim: ts=2 sw=2 et:
